﻿// modificare
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Samples.ServiceHosting.StorageClient;

namespace Ciripescu_WebRole.Entities
{
    public class Cirip : TableStorageEntity
    {
        // PartitionKey in the owner of the cirip (the guy who said it)
        
        public string Content { get; set; }
        public string InReplyToUser { get; set; }
        public string InReplyToId { get; set; }
        public string Version { get; set; }
        // don't use TimeStamp because we may not be able to backup it
        public DateTime TimePosted { get; set; }

        public Cirip(string user, string content)
            : base(user,string.Format("{0:D19}", DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks))
        {            
            this.Content = content;
            this.Version = Properties.Settings.Default.Version;
            this.TimePosted = DateTime.Now;

            this.InReplyToUser = string.Empty;
            this.InReplyToId = string.Empty;
        }

        public Cirip(string user, string content, string inReplyToUser, string inReplyToId)
            : base(user, string.Format("{0:D19}", DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks))
        {            
            this.Content = content;
            this.Version = Properties.Settings.Default.Version;
            this.TimePosted = DateTime.Now;

            this.InReplyToUser = inReplyToUser;
            this.InReplyToId = inReplyToId;
        }
        public Cirip() { }
        
        public string getUser()
        {
            return PartitionKey;
        }
        public string getId()
        {
            return RowKey;
        }

    }
}
;